package cn.jhc.service;

import java.util.List;

import javax.annotation.Resource;
import javax.transaction.Transactional;

import org.springframework.stereotype.Service;

import cn.jhc.DAO.UserDao;
import cn.jhc.model.User;
@Service
public class UserService {

	private UserDao userDao;

	public UserDao getUserDao() {
		return userDao;
	}
@Resource
	public void setUserDao(UserDao userDao) {
		this.userDao = userDao;
	}
@Transactional
public boolean addUser(User user){
		  System.out.println("add");
		  this.userDao.addUser(user);
		  return true;
	
	}
@Transactional
    public void removeUser(User user){
    	this.userDao.removeUser(user);
    }
@Transactional
    public User findUserById(Integer id){
		return this.userDao.findUserById(id);
    	
    }
@Transactional
    public List<User>  findAllUser(){
		return this.userDao.findAllUser();
    	
    }
@Transactional
    public void updateUser(User user){
    	this.userDao.updateUser(user);
    }
}
